using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {
         private Animator anim;
		 public float speed = 0.7f;
         public float acceleration = 1;


        void Start () {

			anim = gameObject.GetComponentInChildren<Animator>();
		}
  
        private void FixedUpdate(){
			    if (Input.GetKey ("a") ) {
				    anim.SetInteger ("AnimationPar", 1);
                    transform.eulerAngles=new Vector3(0,-90,0);
                transform.Translate(new Vector3(-speed*Time.fixedDeltaTime,0,0),Space.World);
                }
                else if (Input.GetKey("d"))
                {
                    anim.SetInteger("AnimationPar", 1);
                    transform.eulerAngles = new Vector3(0, 90, 0);
            transform.Translate(new Vector3(speed * Time.fixedDeltaTime, 0, 0), Space.World);

        }
        else
            {
				    anim.SetInteger ("AnimationPar", 0);
			}
        if (Input.GetKey("w"))
        {
            speed += acceleration * Time.fixedDeltaTime;
        }
        if (Input.GetKey("s"))
        {
            speed -= acceleration * Time.fixedDeltaTime;

        }

    }

    public enum MoveType
    {
        Uniform,
        Accelerate
    }
}
